<%@ page import="org.xilin.Family" %>

<g:setProvider library="jquery"/>

<div>
    <g:if test="${flash.message}">
      <div class="message" style="display:none">${flash.message}</div>
    </g:if>
    <g:hasErrors>
      <div class="errors">
          <g:renderErrors bean="${userInstance}" as="list" />
          <g:renderErrors bean="${familyInstance}" as="list" />
      </div>
    </g:hasErrors>
    <g:formRemote name="saveFamily" url="${[action:'adminSave']}" method="post" update="cluetip-inner" before="beforeSave()" onComplete="processResponse({cluetipWidth:'700px'})">
        <g:hiddenField name="view" value="adminCreate" />
        <g:hiddenField name="user.id" value="${userInstance?.id}" />
        <g:hiddenField name="id" value="${familyInstance?.id}" />
        <div class="dialog">
            <table>
                <tbody>

                    <tr class="prop">
                        <td valign="top" class="name">
                          <label for="user.username"><g:message code="user.username.label" default="Username" /></label>
                        </td>
                        <td valign="top" class="name">
                          <label for="user.passwd"><g:message code="user.passwd.label" default="Password" /></label>
                        </td>
                        <td valign="top" class="name">
                          <label for="user.email"><g:message code="user.email.label" default="Email" /></label>
                        </td>
                    </tr>
                    <tr class="prop">
                        <td valign="top" class="value ${hasErrors(bean: userInstance, field: 'username', 'errors')}">
                          <g:textField name="user.username" value="${userInstance?.username}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: userInstance, field: 'passwd', 'errors')}">
                          <g:passwordField name="user.passwd" value="${userInstance?.passwd}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: userInstance, field: 'email', 'errors')}">
                          <g:textField name="user.email" value="${userInstance?.email}" />
                        </td>
                    </tr>
                    <tr><td colspan="3">&nbsp;</td></tr>
                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="fatherFirstName"><g:message code="family.fatherFirstName.label" default="Father First Name" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="fatherLastName"><g:message code="family.fatherLastName.label" default="Last Name" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="fatherChineseName"><g:message code="family.fatherChineseName.label" default="Chinese Name" /></label>
                        </td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'fatherFirstName', 'errors')}">
                            <g:textField name="fatherFirstName" value="${familyInstance?.fatherFirstName}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'fatherLastName', 'errors')}">
                            <g:textField name="fatherLastName" value="${familyInstance?.fatherLastName}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'fatherChineseName', 'errors')}">
                            <g:textField name="fatherChineseName" value="${familyInstance?.fatherChineseName}" />
                        </td>
                    </tr>
                    <tr><td colspan="3">&nbsp;</td></tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="motherFirstName"><g:message code="family.motherFirstName.label" default="Mother First Name" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="motherLastName"><g:message code="family.motherLastName.label" default="Last Name" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="motherChineseName"><g:message code="family.motherChineseName.label" default="Chinese Name" /></label>
                        </td>
                    </tr>
                    <tr class="prop">
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'motherFirstName', 'errors')}">
                            <g:textField name="motherFirstName" value="${familyInstance?.motherFirstName}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'motherLastName', 'errors')}">
                            <g:textField name="motherLastName" value="${familyInstance?.motherLastName}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'motherChineseName', 'errors')}">
                            <g:textField name="motherChineseName" value="${familyInstance?.motherChineseName}" />
                        </td>
                    </tr>
                    <tr><td colspan="3">&nbsp;</td></tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="address"><g:message code="family.address.label" default="Address" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="city"><g:message code="family.city.label" default="City" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="state"><g:message code="family.state.label" default="State" /></label>
                        </td>
                    </tr>
                    <tr class="prop">
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'address', 'errors')}">
                            <g:textField name="address" value="${familyInstance?.address}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'city', 'errors')}">
                            <g:textField name="city" value="${familyInstance?.city}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'state', 'errors')}">
                            <g:textField name="state" value="${familyInstance?.state}" />
                        </td>
                    </tr>

                    <tr><td colspan="3">&nbsp;</td></tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="zipCode"><g:message code="family.zipCode.label" default="Zip Code" /></label>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>

                    <tr class="prop">
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'zipCode', 'errors')}">
                            <g:textField name="zipCode" value="${familyInstance?.zipCode}" />
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                
                    <tr><td colspan="3">&nbsp;</td></tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="homeTel_1"><g:message code="family.homeTel_1.label" default="Home Tel1" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="homeTel_2"><g:message code="family.homeTel_2.label" default="Home Tel2" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="homeTel_3"><g:message code="family.homeTel_3.label" default="Home Tel3" /></label>
                        </td>
                    </tr>
                    <tr class="prop">
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'homeTel_1', 'errors')}">
                            <g:textField name="homeTel_1" value="${familyInstance?.homeTel_1}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'homeTel_2', 'errors')}">
                            <g:textField name="homeTel_2" value="${familyInstance?.homeTel_2}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'homeTel_3', 'errors')}">
                            <g:textField name="homeTel_3" value="${familyInstance?.homeTel_3}" />
                        </td>
                    </tr>
                    <tr><td colspan="3">&nbsp;</td></tr>

                    <tr class="prop">
                        <td valign="top" class="name">
                            <label for="workTel_1"><g:message code="family.workTel_1.label" default="Work Tel1" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="workTel_2"><g:message code="family.workTel_2.label" default="Work Tel2" /></label>
                        </td>
                        <td valign="top" class="name">
                            <label for="workTel_3"><g:message code="family.workTel_3.label" default="Work Tel3" /></label>
                        </td>
                    </tr>
                    <tr class="prop">
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'workTel_1', 'errors')}">
                            <g:textField name="workTel_1" value="${familyInstance?.workTel_1}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'workTel_2', 'errors')}">
                            <g:textField name="workTel_2" value="${familyInstance?.workTel_2}" />
                        </td>
                        <td valign="top" class="value ${hasErrors(bean: familyInstance, field: 'workTel_3', 'errors')}">
                            <g:textField name="workTel_3" value="${familyInstance?.workTel_3}" />
                        </td>
                    </tr>

                </tbody>
            </table>
        </div>
        <br/>
        <div class="buttons">
            <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
            <span class="button"><input type="reset" value="${message(code: 'default.button.clear.label', default: 'Reset')}" /></span>
        </div>
    </g:formRemote>
</div>
